import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoBlog.settings')
django.setup()

import random
from comment.models import Comment
from django.contrib.auth.models import User
from faker import Faker
from article.models import ArticlePost

faker = Faker('zh_CN')
for _ in range(30):
    article = ArticlePost()
    article.title = faker.text(15)
    article.author = User.objects.get(pk=1)
    article.body = faker.text(200)
    article.total_views = random.randint(10,100)
    article.save()


for _ in range(80):
    comment = Comment()
    comment.user=User.objects.get(pk=random.randint(1,User.objects.count()))
    comment.body = faker.text(100)
    comment.article=ArticlePost.objects.get(pk=random.randint(1,ArticlePost.objects.count()))
    comment.save()